using UnityEngine;
using System.Collections;

public class Tower : MonoBehaviour {
	
	public int player;
	public GameObject explosion;
	
	void OnCollisionEnter(Collision collision) {
		if(collision.gameObject.tag=="Bomb")
		{ 
			print ("DIRECT IMPACT");
			var effect = Instantiate(explosion, collision.gameObject.transform.position, Quaternion.identity);
			Destroy(this.gameObject);		
		}
	}
	
	public void Proximity() {
		print ("Destroyed by proximity");
		Destroy(this.gameObject);
	}
	
	void OnDestroy() {
		if (player == 0) GameVariables.towersPlayer0 -= 1;
		else GameVariables.towersPlayer1 -= 1;
	}
}
